<#assign classNameLower = ClassName ? uncap_first>
package ${pPackage}.controller;

import ${pPackage}.pojo.${ClassName};
import ${pPackage}.service.AuthMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@RestController
@RequestMapping("/${classNameLower}")
public class ${ClassName}Controller {

    @Autowired
    private ${ClassName}Service ${classNameLower}Service;
    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/findAll")
    public Result findAll(int page, int size, String query) {
        List<${ClassName}> list = ${classNameLower}Service.findAll(page, size, query);
        return Result.ok(list);
    }

    @GetMapping("/findById")
    public Result findById(String id) {
        ${ClassName} ${classNameLower} = ${classNameLower}Service.findById(id);
        return Result.ok(${classNameLower});
    }

    @PostMapping("/saveOrUpdate")
    public Result saveOrUpdate(${ClassName} ${classNameLower}) {
        boolean isAdd = StringUtils.isBlank(${classNameLower}.getId());
        if (isAdd){
            ${classNameLower}Service.insert(${classNameLower});
        } else {
            ${classNameLower}Service.update(${classNameLower});
        }
        return Result.ok("保存成功！");
    }

    @DeleteMapping("/delete")
    public Result deleteByIds(String[] ids) {
        for(String id: ids) {
            ${classNameLower}Service.deleteById(id);
        }
        return Result.ok("删除成功！");
    }

}